package com.zhong.gang.applib.ui.matching;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhong.gang.applib.R;

public class MatchingAdapter extends BaseQuickAdapter<MatchingBean, BaseViewHolder> {
    public MatchingAdapter() {
        super(R.layout.item_matching);
    }

    @Override
    protected void convert(BaseViewHolder helper, MatchingBean item) {
        helper.addOnClickListener(R.id.sure);
        TextView name = helper.getView(R.id.name);
        TextView phone = helper.getView(R.id.phone);
        TextView bank = helper.getView(R.id.bank);
        TextView bankNum = helper.getView(R.id.bank_num);
        TextView cardName = helper.getView(R.id.card_name);
        TextView cardNum = helper.getView(R.id.card_num);
        name.setText(item.getConsignor().getName());
        phone.setText(item.getConsignor().getPhone());
        if (TextUtils.isEmpty(item.getConsignorBankCard().getBankBranchName())){
            helper.getView(R.id.bank_layout).setVisibility(View.GONE);
        }else {
            helper.getView(R.id.bank_layout).setVisibility(View.VISIBLE);
            bank.setText(item.getConsignorBankCard().getBankBranchName());
            bankNum.setText(item.getConsignorBankCard().getBankCardNum());
            cardName.setText(item.getConsignorBankCard().getRealName());
            cardNum.setText(item.getConsignorBankCard().getIdCardNum());
        }
    }
}
